package com.taotao.portal.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.taotao.portal.pojo.ItemInfo;
import com.taotao.portal.service.ItemService;

@Controller
public class ItemController {
	@Autowired
	private ItemService itemService;
	
	@RequestMapping("/item/{itemId}")
	public String getItemInfo(@PathVariable long itemId,Map<String,Object> map){
		ItemInfo item = itemService.getItemById(itemId);
		map.put("item", item);
		return "item";
	}
	
	@RequestMapping("/item/desc/{itemId}")
	@ResponseBody
	public String getItemDesc(@PathVariable long itemId){
		String result=itemService.getItemDescById(itemId);
		return result;
	}
	
	@RequestMapping(value="/item/param/{itemId}",produces=MediaType.TEXT_HTML_VALUE+";charset=utf-8")
	@ResponseBody
	public String getItemParam(@PathVariable long itemId){
		String result=itemService.getItemParamById(itemId);
		return result;
	}
}
